﻿<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../helpproject.xsl" ?>
<topic template="Default" lasteditedby="Geert" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../helpproject.xsd">
  <title translate="true">Unit testing in WPF</title>
  <keywords>
    <keyword translate="true">Unit testing</keyword>
    <keyword translate="true">WPF</keyword>
  </keywords>
  <body>
    <header>
      <para styleclass="Heading1"><text styleclass="Heading1" translate="true">Unit testing in WPF</text></para>
    </header>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">Test driven development (TDD) is hot. It&apos;s so hot that if you are a serious developer, you can&apos;t get around it. This part of the documentation explains how to create the unit tests. If you are interested in how to unit test the services that ship with Catel, read the documentation about </text><link displaytype="text" defaultstyle="true" type="topiclink" href="GS_UnitTesting_Unit_testing_services" styleclass="Normal" translate="true">unit testing the services</link><text styleclass="Normal" translate="true">.</text></para>
    <para styleclass="Heading1"><text styleclass="Heading1" translate="true">Creating the unit test project</text></para>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">You can find a </text><text styleclass="Normal" style="font-style:italic;" translate="true">Silverlight Unit Test Application</text><text styleclass="Normal" translate="true"> project template, under Installed Templates &gt; Visual C# &gt; Silverlight in the </text><text styleclass="Normal" style="font-style:italic;" translate="true">Add New Project</text><text styleclass="Normal" translate="true"> wizard in Microsoft Visual Studio 2010.</text></para>
    <para styleclass="Normal"><image src="unittesting_wpf_createproject.png" scale="80.00%" width="764" height="528" styleclass="Image Caption"></image></para>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">This will create a unit test project.</text></para>
    <para styleclass="Heading1"><text styleclass="Heading1" translate="true">Creating your first unit test</text></para>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">First add a reference in the [test project] to the application or class library to test. Then the first unit test is already created by the template for you decorated with the </text><text styleclass="Normal" style="font-style:italic;" translate="true">TestMethod</text><text styleclass="Normal" style="font-style:normal;" translate="true"> attribute.</text></para>
    <para styleclass="Normal"><text styleclass="Normal" style="font-style:normal;" translate="true">To run the unit tests, simple go to Test &gt; Run &gt; Tests in Current Context like shown in the image below: </text></para>
    <para styleclass="Normal"><image src="unittesting_wpf_runall.png" scale="100.00%" styleclass="Image Caption"></image></para>
  </body>
</topic>
